package com.nuoniu.sibanyun.controller.erp.barcode;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.entity.dto.ErpBarcodePrintSearchDto;
import com.nuoniu.sibanyun.entity.erp.barcode.ErpBarcodePrint;
import com.nuoniu.sibanyun.entity.erp.barcode.ErpBarcodeRule;
import com.nuoniu.sibanyun.service.erp.barcode.IErpBarcodePrintService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.nuoniu.sibanyun.common.BaseController;

/**
 * <p>
 * 条码管理-打印 前端控制器
 * </p>
 *
 * @author 白强
 * @since 2021-11-10
 */
@RestController
@RequestMapping("/erp/barcode/print")
@Api(tags = "条码打印")
public class ErpBarcodePrintController extends BaseController {

    @Autowired
    private IErpBarcodePrintService barcodePrintService;


    @GetMapping("page")
    @ApiOperation("分页查询")
    public HttpResult save(Page page, ErpBarcodePrintSearchDto barcodePrintSearchDto){
        return HttpResult.ok(barcodePrintService.pageErpBarcodePrint(page, barcodePrintSearchDto));
    }

    @PostMapping("save")
    @ApiOperation("生成 条码")
    public HttpResult generateBarcode(@RequestBody ErpBarcodePrint erpBarcodePrint){
        return HttpResult.ok(barcodePrintService.generateBarcode(erpBarcodePrint));
    }

    @GetMapping("detailById")
    @ApiOperation("查询详情")
    public HttpResult save(Long id){
        return HttpResult.ok(barcodePrintService.detailById(id));
    }

}
